package at.irian.jsfatwork.broker.web.model;

import org.apache.myfaces.orchestra.conversation.Conversation;
import org.apache.myfaces.orchestra.conversation.ConversationManager;
import org.springframework.stereotype.Component;
import org.springframework.context.annotation.Scope;

import javax.faces.event.AbortProcessingException;
import javax.faces.event.ActionEvent;
import java.util.Iterator;

/**
 * @author Thomas Spiegl
 */
@Component
@Scope("singleton")
public class MenuBean {

    public void resetConversations(ActionEvent e) throws AbortProcessingException {
        for (Iterator<Conversation> it =
                ConversationManager.getInstance(true).iterateConversations(); it.hasNext(); ) {
            it.next().invalidate();
        }

    }
}
